#ifndef DB_SQLITE3_H
#define DB_SQLITE3_H 1

#include <stdarg.h>
#include "db.h"

#define DB_SQ3_SUFFIX	"sq3"
#define SQ3_MAXCOLS 	16
#define SQ3_STMT_LEN	512
#define SQ3_BUSYTIMEOUT 1500

int
db_sqlite3_preinit(void);

void
db_sqlite3_shutdown(void);

int
db_sqlite3_init(const char *path, void **sq3_hndl);

int
db_sqlite3_close(void *sq3_hndl);

int
db_sqlite3_parse_arg(char *arg);

int
db_sqlite3_vexec_simple(void *sq3_hndl, const char *sql, va_list ap);

int
db_sqlite3_exec_simple(void *sq3_hndl, const char *sql, ...);

int
db_sqlite3_exec(void *sq3_hndl, void **sqlite3_stmt, db_result_t **result, const char *sql, const db_stmt_t *st, int len);

void
db_sqlite3_finish_stmt(void *dbstmt);

#define db_parse_arg	db_sqlite3_parse_arg
#define db_preinit	db_sqlite3_preinit
#define db_shutdown	db_sqlite3_shutdown
#define db_init		db_sqlite3_init
#define db_close	db_sqlite3_close
#define db_exec_simple	db_sqlite3_exec_simple
#define db_vexec_simple  db_sqlite3_vexec_simple
#define db_exec		db_sqlite3_exec
#define db_finish_stmt	db_sqlite3_finish_stmt

#endif
